<?php

namespace App\models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Auth\User;
use Spatie\Permission\Models\Role;
use Spatie\Permission\Traits\HasRoles;

class Admin extends User
{
    use HasRoles;
    protected $guarded = [];
    protected $rememberTokenName = '';
    //    获取用户所属角色
    public function getRoleAttribute(){
        return Role::whereIn('name',$this->getRoleNames())->get();
    }
}
